/** 用户名记录 */
const allUsername = []

/** 用户登录 */
function loginUser(username) {
  if (allUsername.includes(username)) return false
  allUsername.push(username)

  return true
}

/** 退出登录 */
function exitUser(username) {
  const userIndex = allUsername.indexOf(username)
  if (userIndex) {
    allUsername.splice(userIndex, 1)
  }
}

module.exports = {
  loginUser,
  exitUser
}
